import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://cn.vitejs.dev/config/
export default defineConfig({
  root: resolve(process.cwd(), 'demo'),

  publicDir: resolve(process.cwd(), 'public'),

  plugins: [vue()],

  resolve: {
    alias: [{ find: '@', replacement: resolve(__dirname, '') }]
  },

  css: {
    preprocessorOptions: {
      scss: {
        // scss 附加全局注入
        additionalData: `
          @use "sass:math";
          @import "@/assets/css/global.scss";
        `
      }
    }
  }
})
